﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Management_ChargeNurse_Benhnhan : System.Web.UI.Page
{
    static int currentIDPatient;
    static int currentAppCode;
    static int currenttab;

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            //get Charge Nurse ID
            int ID = ((Authentication)Session[GlobalConstant.LOGIN_STATE]).userID;
            int IDWard = Management_Danhsachnhanvien.getIDWardFromIDStaff(ID);
            phongDS.SelectParameters["IDWard"].DefaultValue = IDWard.ToString();
            GridView1.DataBind();
            benhDS.SelectParameters["IDWard"].DefaultValue = IDWard.ToString();
            GridView3.DataBind();
        }
        TabContainer1.ActiveTabIndex = currenttab;

    }

    protected void danhsachgiuong_click(object sender, EventArgs e)
    {
        string phong = (sender as LinkButton).CommandArgument;
        benhnhanDS.SelectParameters["IDRoom"].DefaultValue = phong;
        GridView2.DataBind();
        Thongtinbenhnhan1.setVisible(false);
        lbDanhsachgiuong.Text = "Phòng: " + phong;
    }

    protected void benhnhan_click(object sender, EventArgs e)
    {
        string id = (sender as LinkButton).CommandArgument;        
        if (!id.Equals("&"))
        {
            string[] args = id.Split('&');
            currentIDPatient = Int32.Parse(args[0]);
            currentAppCode = Int32.Parse(args[1]);
            Thongtinbenhnhan1.loadThongTin(currentIDPatient);
            pnTT.Visible = true;
        }
    }
    protected void btUpdateDrug_Click(object sender, EventArgs e)
    {
        Response.Redirect("~/Management/ChargeNurse/Donthuoc.aspx?ID="+currentIDPatient+"&AppCode="+currentAppCode);
    }

    protected void tab_changed(object sender, EventArgs e)
    {
        currenttab = TabContainer1.ActiveTabIndex;
    }
}